package xyz.luckyli.springcloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import xyz.luckyli.springcloud.pojo.Dept;
import xyz.luckyli.springcloud.service.DeptClientService;

import java.util.List;


/**
 * ClassName:DeptConsumerController
 * Package:xyz.luckyli.springcloud.controller
 * Description:
 *
 * @Date:2020/9/29 15:06
 * @Author:857251389@qq.com
 */

@RestController
public class DeptConsumerController {


    @Autowired
    private DeptClientService deptClientService;

    @RequestMapping("/consumer/dept/add")
    public Boolean add(Dept dept){
        return this.deptClientService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/get/{id}")
    public Dept getById(@PathVariable("id") Long id){
        return this.deptClientService.queryById(id);
    }

    @RequestMapping("/consumer/dept/list")
    public List<Dept> list(){

        return this.deptClientService.queryAll();
    }




}
